package com.my.study.dev;

import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedType;

/**
 * @author Carlos
 * @version 1.0.0
 * @date 2023/2/15 8:20
 */
@NotNull("demo")
public class TypeUseDemo {

    @NotNull("age")
    public Integer age = 21;

    public @NotNull("number") Integer number(@NotNull("不可为空") Integer num) {
        return num;
    }


    public static void main(String[] args) throws NoSuchMethodException, NoSuchFieldException {
        Annotation[] annotations = TypeUseDemo.class.getAnnotations();

        AnnotatedType[] numbers = TypeUseDemo.class.getMethod("number", Integer.class).getAnnotatedParameterTypes();


        AnnotatedType number = TypeUseDemo.class.getMethod("number", Integer.class).getAnnotatedReturnType();
        Annotation[] annotations1 = number.getAnnotations();

        Annotation[] notNull = TypeUseDemo.class.getField("age").getAnnotatedType().getAnnotations();


        System.out.println("");
    }
}

